const express = require('express');
const router = express.Router();
const faceAnalysisController = require('../controllers/faceAnalysis.controller');
const { authenticateToken } = require('../middleware/auth.middleware');

/**
 * @route POST /api/face-analysis/analyze
 * @desc 上传面部图片进行面相分析
 * @access Public
 */
router.post('/analyze', faceAnalysisController.analyzeFace);

/**
 * @route GET /api/face-analysis/result/:id
 * @desc 获取面相分析结果
 * @access Public
 */
router.get('/result/:id', faceAnalysisController.getFaceAnalysis);

/**
 * @route POST /api/face-analysis/save
 * @desc 保存面相分析结果（需要认证）
 * @access Private
 */
router.post('/save', authenticateToken, faceAnalysisController.saveFaceAnalysis);

/**
 * @route GET /api/face-analysis/my-analyses
 * @desc 获取当前用户的面相分析历史记录（需要认证）
 * @access Private
 */
router.get('/my-analyses', authenticateToken, faceAnalysisController.getUserFaceAnalyses);

module.exports = router;